<?php

$servername = 'localhost';
$username = 'root';
$password = 'root';

// 创建连接
$conn = new mysqli($servername, $username, $password);

// 检测连接
if ($conn -> connect_error) {
	die("连接失败：" . $conn -> connect_error);
}

echo '连接成功' . PHP_EOL;

try
{

	$conn -> close();
	echo '关闭连接成功' . PHP_EOL;
	throw new Exception("变量值必须小于等于 1");
}
catch(Exception $e)
{
    echo 'Message: ' . $e->getMessage();
}
?>